package cn.goour.yiban.app.action;

import cn.goour.utils.http.Http;
import cn.goour.utils.http.HttpConfig;
import cn.goour.utils.http.Params;
import cn.goour.utils.security.impl.MD5Impl;
import cn.goour.utils.tools.NullValid;
import cn.goour.yiban.app.entity.User;
import com.alibaba.fastjson.JSONObject;
import com.lcb123.YBPlatform;
import java.io.File;
import java.net.URI;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.java_websocket.WebSocket;
import org.java_websocket.drafts.Draft_6455;
import org.java_websocket.handshake.ServerHandshake;

public class YiBanRequest {
	private static final Map<String, String> head = new HashMap();
	private WebSocketChat client;
	private String cookie = "";
	private User user;

	static {
		head.put("appVersion", "4.4.3");
	}

	public YiBanRequest() {
	}

	public YiBanRequest(User user2) {
		this.user = user2;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user2) {
		this.user = user2;
	}

	public String getCookie() {
		return this.cookie;
	}

	public void setCookie(String cookie2) {
		this.cookie = cookie2;
	}

	public synchronized WebSocketChat getChatClient(IChat iChat) throws Exception {
		if (this.client == null || this.client.isClosed() || !this.client.isOpen()) {
			synchronized (YiBanRequest.class) {
				if (this.client == null || this.client.isClosed() || !this.client.isOpen()) {
					this.client = new WebSocketChat(new URI("ws://112.65.235.70:4261/socket.io/1/websocket/" + new String(getChatStep1(), "utf-8").split(":")[0]), new Draft_6455(), iChat);
					this.client.setAction(this);
					this.client.setConnectionLostTimeout(30000);
					this.client.setTcpNoDelay(true);
					this.client.connect();
					do {
					} while (!this.client.getReadyState().equals(WebSocket.READYSTATE.OPEN));
				}
			}
		}
		return this.client;
	}

	public synchronized WebSocketChat getChatClient() throws Exception {
		return getChatClient(new IChat() {
			/* class cn.goour.yiban.app.action.YiBanRequest.AnonymousClass1 */

			@Override // cn.goour.yiban.app.action.IChat
			public void send5(String text) {
			}

			@Override // cn.goour.yiban.app.action.IChat
			public void send(String text) {
			}

			@Override // cn.goour.yiban.app.action.IChat
			public void onOpen(ServerHandshake handshakedata) {
			}

			@Override // cn.goour.yiban.app.action.IChat
			public void onMessage(String message) {
			}

			@Override // cn.goour.yiban.app.action.IChat
			public void onClose(int code, String reason, boolean remote) {
			}
		});
	}

	public static String signature(String userid, String access_token, String timeStamp) {
		return YBPlatform.signature(userid, access_token, timeStamp);
	}

	public static JSONObject getLogin(User user2) throws Exception {
		String string = MD5Impl.getInstance().EncryptionToString(UUID.randomUUID().toString());
		Params params = new Params();
		params.add("account", user2.getPhone());
		params.add("passwd", URLEncoder.encode(user2.getPassword(), "utf-8"));
		params.add("ct", "2");
		params.add("app", "1");
		params.add("v", "4.7.11");
		params.add("identify", "0");
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/passport/login", params.getParams(), head)), "utf-8"));
	}

	public static JSONObject getAutoLogin(User user2) throws Exception {
		Params params = new Params();
		params.add("access_token", user2.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/passport/autologin", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getAppHome() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/home", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getAppHomeNews(int kind, Object page) throws Exception {
		String type;
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		switch (kind) {
			case 1:
				type = "yiban";
				break;
			case 2:
				type = "college";
				break;
			case 3:
				type = "class";
				break;
			default:
				type = "yiban";
				break;
		}
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/home/news/" + type, params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersConfig() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/users/" + this.user.getUser_id() + "/config", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsSelf(Object lastId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("direction", page);
		params.add("compareId", lastId);
		params.add("limit", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsUps(Object feedId) throws Exception {
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/" + feedId + "/ups?access_token=" + this.user.getAccess_token(), new Params().getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsDowns(Object feedId) throws Exception {
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/" + feedId + "/downs?access_token=" + this.user.getAccess_token(), new Params().getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsCommentsAdd(Object feedId, String content) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("content", URLEncoder.encode(content, "utf-8"));
		params.add("toUserId", "");
		params.add("toCommentId", "");
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/" + feedId + "/comments", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsCommentsDel(Object feedId, Object commentId) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.delete(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/" + feedId + "/comments/" + commentId, params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsADD(String content, String address, String lat, String lng) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("content", URLEncoder.encode(content, "utf-8"));
		params.add("visibleScope", "0");
		params.add("artwork", "0");
		params.add("toUserIds", "");
		params.add("address", URLEncoder.encode(address, "utf-8"));
		params.add("lat", lat);
		params.add("lng", lng);
		params.add("share", "0");
		params.add("shareTitle", "");
		params.add("shareUrl", "");
		params.add("shareContent", "");
		params.add("shareImage", "");
		params.add("shareSource", "");
		params.add("kind", "1");
		params.add("hiddenAddress", "0");
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsADD_IMG(String content, String address, String lat, String lng, File[] files) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("content", URLEncoder.encode(content, "utf-8"));
		params.add("visibleScope", "0");
		params.add("artwork", "0");
		params.add("toUserIds", "");
		params.add("address", URLEncoder.encode(address, "utf-8"));
		params.add("lat", lat);
		params.add("lng", lng);
		params.add("share", "0");
		params.add("shareTitle", "");
		params.add("shareUrl", "");
		params.add("shareContent", "");
		params.add("shareImage", "");
		params.add("shareSource", "");
		params.add("kind", "1");
		params.add("hiddenAddress", "0");
		Map<String, File[]> map = new HashMap<>();
		map.put("image[]", files);
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds", head), params.getParamsMap(), map), "utf-8"));
	}

	public String getWeiBo(String content) throws Exception {
		HttpConfig config = new HttpConfig("http://vsdh.yiban.cn/weibo/index.php?view=ajax&action=publish", String.format("pic=%s&content=%s", "0", URLEncoder.encode(content, "utf-8")));
		config.setReferer("http://vsdh.yiban.cn/weibo");
		config.setAjax(true);
		config.setJsonAccept();
		if (NullValid.isNull(this.cookie)) {
			this.cookie = getWebCookies();
		}
		config.setHeader("cookie", this.cookie + "login_username=" + this.user.getNick() + "; LUN=" + this.user.getNick() + "; POWER=100; isVip=1;timezone=-8; UID=" + this.user.getUser_id() + "; AREA=43; OS=%B2%E9%BF%B4%B2%A9%CE%C4;");
		return new String(Http.post(config), "utf-8");
	}

	@Deprecated
	public String getBlog(String content, String title, String ranges, String type, String keywords, String token) throws Exception {
		HttpConfig config = new HttpConfig("http://www.yiban.cn/blog/blog/addblog", String.format("title=%s&content=%s&ranges=%s&type=%s&token=%s&keywords=%s", URLEncoder.encode(title, "utf-8"), URLEncoder.encode(content, "utf-8"), URLEncoder.encode(ranges, "utf-8"), URLEncoder.encode(type, "utf-8"), URLEncoder.encode(token, "utf-8"), URLEncoder.encode(keywords, "utf-8")));
		config.setReferer("http://www.yiban.cn/");
		config.setAjax(true);
		config.setJsonAccept();
		if (NullValid.isNull(this.cookie)) {
			this.cookie = getWebCookies();
		}
		config.setHeader("cookie", this.cookie);
		return new String(Http.post(config), "utf-8");
	}

	public JSONObject getFeedsShares(String content, String address, String lat, String lng, String shareTitle, String shareUrl, String shareContent, String shareImage, String shareSource) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("content", URLEncoder.encode(content, "utf-8"));
		params.add("visibleScope", "0");
		params.add("artwork", "0");
		params.add("toUserIds", "");
		params.add("address", URLEncoder.encode(address, "utf-8"));
		params.add("lat", lat);
		params.add("lng", lng);
		params.add("share", "1");
		params.add("shareTitle", URLEncoder.encode(shareTitle, "utf-8"));
		params.add("shareUrl", URLEncoder.encode(shareUrl, "utf-8"));
		params.add("shareContent", URLEncoder.encode(shareContent, "utf-8"));
		params.add("shareImage", URLEncoder.encode(shareImage, "utf-8"));
		params.add("shareSource", URLEncoder.encode(shareSource, "utf-8"));
		params.add("kind", "1");
		params.add("hiddenAddress", "0");
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeddsDELETE(Object feedId) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.delete(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/" + feedId, params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsMessages(Object lastId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("direction", page);
		params.add("compareId", lastId);
		params.add("limit", size);
		return JSONObject.parseObject(new String(Http.delete(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/messages", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersInfo(Object user_id) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/user/" + user_id, params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFeedsOther(Object user_id, Object lastId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("userId", user_id);
		params.add("direction", page);
		params.add("compareId", lastId);
		params.add("limit", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/user", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersHome(Object user_id) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/users/" + user_id, params.getParams(), head)), "utf-8"));
	}

	public JSONObject getSchoolVerify() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/users/" + this.user.getUser_id() + "/school", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getMoneyLog(Object page) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/user/money", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersQRCard(Object user_id) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/users/" + user_id + "/card", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFilesSelf(String path, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		params.add("num", size);
		if (!NullValid.isNull(page)) {
			params.add("path", URLEncoder.encode(path, "utf-8"));
		}
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/ydfs/directorys", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFilesShareList(Object page, Object size, Object by) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		params.add("num", size);
		params.add("by", by);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/ydfs/shares", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersFriends() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/user/friends", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFriendsApply(Object page, Object size, Object lastId) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		params.add("size", size);
		params.add("last_id", lastId);
		params.add("order", "DESC");
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/user/friends/apply", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getGroupsApply(Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		params.add("size", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/groups/apply", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getGroupsIndex(Object groupID, Object user_id) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("user_id", user_id);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/groups/" + groupID, params.getParams(), head)), "utf-8"));
	}

	public JSONObject getGroupsFeeds(Object groupID, Object user_id) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("groupid", groupID);
		params.add("puserid", user_id);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/groups/lastvotecom", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersFollows(Object kind) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("kind", kind);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/user/follows", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getOrgIndex(Object orgId) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/organizations/" + orgId, params.getParams(), head)), "utf-8"));
	}

	public JSONObject getOrgRecommendList(Object orgId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("user_id", orgId);
		params.add("page", page);
		params.add("num", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/organization/recommendlist", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getOrgIndexApps(Object orgId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("user_id", orgId);
		params.add("page", page);
		params.add("num", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/organization/applications", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getOrgRecommendTeachers(Object orgId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("user_id", orgId);
		params.add("page", page);
		params.add("num", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/organization/recommendteachers", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getOrgGroups(Object orgId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("user_id", orgId);
		params.add("page", page);
		params.add("num", size);
		params.add("kind", 2);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/groups", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersGroups(Object size, boolean isOrgGroup) throws Exception {
		int is_org_group = 0;
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("my_group_type", 0);
		params.add("num", size);
		if (isOrgGroup) {
			is_org_group = 1;
		}
		params.add("is_org_group", Integer.valueOf(is_org_group));
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/groups/mygroups", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersGroupsAll() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("kind", 1);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/groups", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getUsersGroupsLow(int kind, int page, int num) throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		params.add("kind", Integer.valueOf(kind));
		params.add("page", Integer.valueOf(page));
		params.add("num", Integer.valueOf(num));
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/user/joinGroups", params.getParams())), "utf-8"));
	}

	public JSONObject getSearchUsers(String keyword, int search, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("keyword", URLEncoder.encode(keyword, "utf-8"));
		params.add("search", Integer.valueOf(search));
		params.add("page", page);
		params.add("num", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/search/users", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getGroupsSearch(String keyword, Object page, Object size, boolean isOrgGroup) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("keywords", URLEncoder.encode(keyword, "utf-8"));
		params.add("page", page);
		params.add("num", size);
		params.add("isOrganGroups", Integer.valueOf(isOrgGroup ? 1 : 0));
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/recommend/groups/search", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFriendsRecommends(int user_type) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("user_type", Integer.valueOf(user_type));
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/friends/recommend", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFriendsADD(Object user_id) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("friend_id", user_id);
		params.add("reason", 1);
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v1/user/friends/apply", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getCheckin_Question() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/activity/sign/question", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getCheckin_Answer(Object optionId, Object feeds) throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		params.add("optionId", optionId);
		params.add("feeds", feeds);
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v3/checkin/answer", params.getParams())), "utf-8"));
	}

	public JSONObject getYiBanMessage(Object page, Object num) throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		params.add("num", num);
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v1/users/" + this.user.getUser_id() + "/messagebox/list", params.getParams())), "utf-8"));
	}

	public JSONObject getBanner() throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/home/banner", params.getParams())), "utf-8"));
	}

	public JSONObject getStudentId() throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		params.add("id", Integer.valueOf(this.user.getUser_id()));
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/user/student", params.getParams())), "utf-8"));
	}

	public JSONObject getHotApp() throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		params.add("provinceOrg", "1");
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/home/hotapp", params.getParams())), "utf-8"));
	}

	public JSONObject getFeedsCheckIn(Object lastId, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		params.add("direction", page);
		params.add("compareId", lastId);
		params.add("limit", size);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/checkin", params.getParams())), "utf-8"));
	}

	public JSONObject getCheckVersion() throws Exception {
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/version/checkupdate")), "utf-8"));
	}

	public JSONObject getPacketRangeUserLuck() throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/money/envelopes/global-list-lucky", params.getParams())), "utf-8"));
	}

	public JSONObject getPacketRangeUserTop() throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/money/envelopes/global-list-rich", params.getParams())), "utf-8"));
	}

	public static JSONObject getProvinceList() throws Exception {
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/area")), "utf-8"));
	}

	public JSONObject getLightAppApplicationUser(Object page, Object num) throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		params.add("page", page);
		params.add("num", num);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/application/user", params.getParams())), "utf-8"));
	}

	public JSONObject getLightAppCategory() throws Exception {
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v2/application/labels")), "utf-8"));
	}

	public JSONObject getUsersUnGroupFriends() throws Exception {
		Params params = new Params();
		params.add("appVersion", "4.4.3");
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v1/user/ungroupfriends", params.getParams())), "utf-8"));
	}

	public JSONObject getNode(Object userid) throws Exception {
		Params params = new Params();
		params.add("userid", userid);
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn:4888/getNode", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getWebSocketAddress() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/im/server", params.getParams(), head)), "utf-8"));
	}

	public JSONObject getFilesToSaveMe(String path, Object userid) throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		params.add("path", URLEncoder.encode(path, "utf-8"));
		params.add("uid", userid);
		return JSONObject.parseObject(new String(Http.post(new HttpConfig("http://mobile.yiban.cn/api/v2/ydfs/transfile", params.getParams(), head)), "utf-8"));
	}

	public byte[] download(String url) throws Exception {
		return Http.get(new HttpConfig(url));
	}

	public JSONObject getArticleList(Object channel_id, Object group_id, Object puid, Object page, Object size) throws Exception {
		Params params = new Params();
		params.add("channel_id", channel_id);
		params.add("group_id", group_id);
		params.add("puid", puid);
		params.add("page", page);
		params.add("size", size);
		params.add("orderby", "updateTime");
		params.add("Sections_id", "-1");
		params.add("need_notice", "0");
		params.add("my", "0");
		HttpConfig config = new HttpConfig("http://www.yiban.cn/forum/article/listAjax", params.getParams());
		config.setReferer("http://www.yiban.cn/forum/article/list/groupid/" + group_id + "/puserid/" + puid + "?type=topic");
		config.setJsonAccept();
		config.setAjax(true);
		config.setHeader("cookie", this.cookie);
		return JSONObject.parseObject(new String(Http.post(config), "utf-8"));
	}

	public JSONObject getArticleADD(Object channel_id, Object group_id, Object puid, String title, String content) throws Exception {
		Params params = new Params();
		params.add("channel_id", channel_id);
		params.add("puid", puid);
		params.add("title", URLEncoder.encode(title, "utf-8"));
		params.add("article_id", "");
		params.add("content", URLEncoder.encode(content, "utf-8"));
		params.add("isNotice", "");
		params.add("pubArea", group_id);
		params.add("Sections_id", "0");
		HttpConfig config = new HttpConfig("http://www.yiban.cn/forum/article/addAjax", params.getParams());
		config.setReferer("http://www.yiban.cn/forum/article/list/groupid/" + group_id + "/puserid/" + puid + "?type=topic");
		config.setJsonAccept();
		config.setAjax(true);
		config.setHeader("cookie", this.cookie);
		return JSONObject.parseObject(new String(Http.post(config), "utf-8"));
	}

	public JSONObject getArticleChannelInfo(Object group_id, Object puid) throws Exception {
		Params params = new Params();
		params.add("puid", puid);
		params.add("group_id", group_id);
		HttpConfig config = new HttpConfig("http://www.yiban.cn/forum/api/getListAjax", params.getParams());
		config.setReferer("http://www.yiban.cn/forum/article/list/groupid/" + group_id + "/puserid/" + puid);
		config.setJsonAccept();
		config.setAjax(true);
		config.setHeader("cookie", this.cookie);
		return JSONObject.parseObject(new String(Http.post(config), "utf-8"));
	}

	public String getWebCookies() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		HttpConfig config = new HttpConfig("http://www.yiban.cn/login/accessTokenLogin", params.getParams(), head);
		config.setHeader("X-Requested-With", "com.yiban.app");
		Http.get(config);
		return config.getBackHeaderCookieString();
	}

	public byte[] getChatStep1() throws Exception {
		head.put("Authorization", "Bearer " + this.user.getAccess_token());
		return Http.get(new HttpConfig("http://112.65.235.55:4252/socket.io/1/", head));
	}

	public JSONObject getFeedsUntouched() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn/api/v3/feeds/untouched", params.getParams(), head)), "utf-8"));
	}

	public JSONObject a() throws Exception {
		Params params = new Params();
		params.add("access_token", this.user.getAccess_token());
		return JSONObject.parseObject(new String(Http.get(new HttpConfig("http://mobile.yiban.cn", params.getParams(), head)), "utf-8"));
	}
}